﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Schema;
using System.Windows.Forms;
using System.Data;

namespace MusicXML
{
    class MusicData
    {
        public static XmlDocument Data = new XmlDocument();
        public static XmlDocument PartData = new XmlDocument();
        public static void LoadFile(string path)
        {
            Data.XmlResolver = null;
            try
            {
                Data.Load(path);
                PartData.LoadXml("<root>" + Data.GetElementsByTagName("part")[0].InnerXml + "</root>");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public static void SaveFile(string path)
        {
            Data.Save(path);
        }

        public static string GetTitle()
        {
            string title = "";
            try
            {
                title = Data.GetElementsByTagName("movement-title")[0].InnerText;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return title;
        }

    }
}
